
/*
输出满足ax+by=gcd(a,b)的x，y的整数值。(一个解就行了）
*/

#include <iostream>

using namespace std;

int gcd(int m,int n)
{
  int temp;
  while( n != 0)
	{
		if(m < n)
		{
			temp = m;
			m = n;
			n = temp;
		}
		else
		{
			m = m - n;
		}
	}

  return m;
}

int gcdEX(int a,int & x,int b,int & y,int c)
{
  int r = 0;
  if(y==0)
  {
    if(c % a == 0)
    {
       x = c/a;
       return 1;
     }
    else return 0;
  }
  else
  {
    int s,t;
    r = gcdEX(b,s,a%b,t,c);
    x = t,y = s-(a/b)*t;
  //  std::cout << x << " " << y << '\n';

  }
  return r;

}//1表示有解，0表示无解；


int main(void) {
  int a,b,c,x,y;
  cin >> a >> b;
  c = gcd(a,b);
  x = y = 1;
  if(b>a)
  {
    x=a;
    a=b;
    b=x;
  }
  std::cout << a<< "x + " << b<<"y = " << c << '\n';

  if(gcdEX(a,x,b,y,c)==0)
  {
    std::cout << "无整数解" << '\n';
    return 0;
  }

  std::cout << x << " " << y << '\n';


  return 0;
}
